package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.templates.commands.ConveyorLift;
import edu.wpi.first.wpilibj.templates.commands.ConveyorLower;
import edu.wpi.first.wpilibj.templates.commands.ConveyorStop;
import edu.wpi.first.wpilibj.templates.commands.DriveToBalance;
import edu.wpi.first.wpilibj.templates.commands.DriveWithJoystick;
import edu.wpi.first.wpilibj.templates.commands.HatchClose;
import edu.wpi.first.wpilibj.templates.commands.HatchOpen;
import edu.wpi.first.wpilibj.templates.commands.HatchStop;
import edu.wpi.first.wpilibj.templates.commands.ShootBalls;

//import commands
//import edu.wpi.first.wpilibj.templates.commands.ScoopOn;

public class OI {
    // Process operator interface input here.
    private Joystick leftstick = new Joystick(RobotMap.leftstick_port);
    private Joystick rightstick = new Joystick(RobotMap.rightstick_port);

    //left (driving) joystick buttons
    Button lftbtn7 = new JoystickButton(leftstick, 7),
           lftbtn8 = new JoystickButton(leftstick, 8);
           //lftbtn9 = new JoystickButton(leftstick, 9);

    //right joystick buttons
    Button rtbtn1 = new JoystickButton(rightstick, 1),
           rtbtn2 = new JoystickButton(rightstick, 2),
           rtbtn3 = new JoystickButton(rightstick, 3);
           //rtbtn4 = new JoystickButton(rightstick, 4),
           //rtbtn5 = new JoystickButton(rightstick, 5),
           //rtbtn6 = new JoystickButton(rightstick, 6),
           //rtbtn7 = new JoystickButton(rightstick, 7);

    //boolean rtbtn7last = false;

    public OI(){
        lftbtn7.whileHeld(new DriveToBalance());
        lftbtn8.whenPressed(new DriveWithJoystick());  //this is probably not needed

        rtbtn1.whenPressed(new ShootBalls()); //change this to the trigger button
        rtbtn2.whileHeld(new HatchOpen());
        rtbtn2.whenReleased(new HatchStop()); //this might not be needed
        rtbtn3.whileHeld(new HatchClose());
        rtbtn3.whenReleased(new HatchStop()); //this might not be needed
        //rtbtn4.whenPressed(new ConveyorLift());
        //rtbtn5.whenPressed(new ConveyorLower());
        //rtbtn6.whenPressed(new ConveyorStop());
    }

    /**
     * @return The X value of the left (driving) joystick.
     */
    public double getleftstickX() {
        return leftstick.getX();
    }

    /**
     * @return The Y value of the left (driving) joystick.
     */
    public double getleftstickY() {
        return leftstick.getY();
    }

    /**
     * @return The twist value of the left (driving) joystick.
     */
    public double getleftstickTwist() {
        return leftstick.getTwist();
    }

    public double getrightstickY(){
        return rightstick.getY();
    }

}